package com.example.common.Entity;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.Objects;

@Entity
@Table(name = "undo_log", schema = "mo_yu_ucenter", catalog = "")
public class UndoLog {
    private long branchId;
    private String xid;
    private String context;
    private byte[] rollbackInfo;
    private int logStatus;
    private Timestamp logCreated;
    private Timestamp logModified;

    @Basic
    @Column(name = "branch_id")
    public long getBranchId() {
        return branchId;
    }

    public void setBranchId(long branchId) {
        this.branchId = branchId;
    }

    @Basic
    @Column(name = "xid")
    public String getXid() {
        return xid;
    }

    public void setXid(String xid) {
        this.xid = xid;
    }

    @Basic
    @Column(name = "context")
    public String getContext() {
        return context;
    }

    public void setContext(String context) {
        this.context = context;
    }

    @Basic
    @Column(name = "rollback_info")
    public byte[] getRollbackInfo() {
        return rollbackInfo;
    }

    public void setRollbackInfo(byte[] rollbackInfo) {
        this.rollbackInfo = rollbackInfo;
    }

    @Basic
    @Column(name = "log_status")
    public int getLogStatus() {
        return logStatus;
    }

    public void setLogStatus(int logStatus) {
        this.logStatus = logStatus;
    }

    @Basic
    @Column(name = "log_created")
    public Timestamp getLogCreated() {
        return logCreated;
    }

    public void setLogCreated(Timestamp logCreated) {
        this.logCreated = logCreated;
    }

    @Basic
    @Column(name = "log_modified")
    public Timestamp getLogModified() {
        return logModified;
    }

    public void setLogModified(Timestamp logModified) {
        this.logModified = logModified;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        UndoLog undoLog = (UndoLog) o;
        return branchId == undoLog.branchId && logStatus == undoLog.logStatus && Objects.equals(xid, undoLog.xid) && Objects.equals(context, undoLog.context) && Arrays.equals(rollbackInfo, undoLog.rollbackInfo) && Objects.equals(logCreated, undoLog.logCreated) && Objects.equals(logModified, undoLog.logModified);
    }

    @Override
    public int hashCode() {
        int result = Objects.hash(branchId, xid, context, logStatus, logCreated, logModified);
        result = 31 * result + Arrays.hashCode(rollbackInfo);
        return result;
    }
}
